package leetcode.jianzhioffer;



/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-11-04 21:01
 **/
public class JianZhiOffer36 {


    Node prev;
    Node head;


    /*public Node treeToDoublyList(Node root) {
        if (root == null) {
            return root;
        }
        dfs(root);
        //首尾互指，形成环形链表
        head.left = prev;
        prev.right = head;
        return head;
    }

    //中序遍历
    private void dfs(Node node) {
        if (node == null) {
            return;
        }
        dfs(node.left);
        if (prev != null) {
            prev.right = node;
        } else {
            head = node;
        }
        node.left = prev;
        prev = node;
        dfs(node.right);
    }*/

}

